<?php

class RealityDetail extends AbstractBox {
	
	protected $template = 'reality/detail.tpl';
	
	/**
	 * @var	tslib_pibase
	 */
	protected $cObject = NULL;
	
	public function __construct($cObject) {
		$this->cObject = $cObject;
	}
	
	protected function setup() {
		$realityRepository = new RealityRepository();
		$reality = $realityRepository->getOneByAlias(Utils::get('alias'));
		if ($reality) {
			// updatneme pocet videni
			$reality['view_count'] = $reality['view_count'] + 1;
			$reality['tstamp'] = time();
			$reality->save();
			
			$reality['bodytext'] = $this->cObject->pi_RTEcssText($reality['bodytext']);
		}
		MySmarty::assign('reality', $reality);
	}
}

?>